import instance, {apiUrl} from "@/utils/http.js";
import axios from 'axios'
const token = localStorage.getItem("token")

export const routerURl = {
    img: 'https://api.jikan.moe/v4',
    anime: '/GV',
    animeList: '/animeList/',
    videoPlay: '/playGV'
}


/**
 * 专门用于文件上传的Axios实例
 */
const uploadInstance = axios.create({
    baseURL: apiUrl,
    timeout: 15000, // 文件上传需要更长的超时时间
    headers: {
        'Content-Type': 'multipart/form-data', // 固定为文件上传类型
        'Authorization': `Bearer ${token}`
    }
});

// 可以复用相同的响应拦截器
uploadInstance.interceptors.response.use(
    instance.interceptors.response.handlers[0],
    instance.interceptors.response.handlers[1]
);

export default uploadInstance;